import ErrorView from '@/views/error/error.vue';
import { h } from 'vue'
import { getContext } from './app-context';

export default function (view) {
    return {
        data() {
            return {};
        },
        async beforeCreate() {
            getContext.call(this);
        },
        created() {
        },
        computed: {
            pageMessage() {
                return this.$store.state.pageMessage || {};
            }
        },
        methods: {

        },

        render() {
            if (this.pageMessage.code) {
                return h(ErrorView, {
                    ...this.pageMessage
                });
            } else {
                return h(view);
            }
        }
    }
}